package models;

import play.db.jpa.Model;

import javax.persistence.*;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

@Entity(name = "profile")
public class Profile extends Model {

    @Column(name = "description")
    public String description;


    @ManyToMany(cascade = CascadeType.ALL)
    public Set<Task> tasks = new HashSet<Task>();
    //    @OneToMany(mappedBy = "profile")
//    public List<Register> registers;
    @OneToMany
    public List<Inscription> inscriptions;


    public static Profile getAsistentProfile() {
        return Profile.find("byDescription", ASISTANT).first();
    }

    @Transient
    public static final String  SUPERADMIN = "SUPERADMIN";
    @Transient
    private static final String ADMIN = "ADMIN";
    @Transient
    private static final String COLLABORATOR = "COLLABORATOR";
    @Transient
    private static final String ASISTANT = "ASISTANT";


    @Override
    public String toString() {
        return description.toString();
    }
}
